package com.sense.kukoo.biz_me.model

import com.sense.kukoo.common.mvvm.model.BaseMvvmModel
import com.sense.kukoo.common.repo.bean.ResultBean
import com.sense.kukoo.common.repo.http.KukooHttpApi
import com.sense.kukoo.common.repo.http.KukooHttpManager
import com.sense.kukoo.common.repo.http.bean.UserSearchBean
import okhttp3.RequestBody

class FollowingsListModel: BaseMvvmModel() {

    private val TAG: String = javaClass.simpleName

    override fun onModelCleared() {}

    suspend fun userSubscriptionPage(isFans: Int, pageIndex:Int, pageSize:Int): ResultBean<List<UserSearchBean>> {
        val hashMap = HashMap<String, Any>()
        hashMap.put("isFans", isFans)//类型: 1/查询粉丝数据 0/查询关注数据
        hashMap.put("pageIndex", pageIndex)
        hashMap.put("pageSize", pageSize)
        val mRequestBody: RequestBody = KukooHttpManager.createRequestBody(hashMap)

        return KukooHttpManager.instance
            .createHttpClient(KukooHttpApi::class.java)
            .userSubscriptionPage(mRequestBody)
    }

    suspend fun subscription(
        userId: Long
    ): ResultBean<Boolean> {
        return KukooHttpManager.instance
            .createHttpClient(KukooHttpApi::class.java)
            .subscription("${userId}")
    }
}